/**
 入驻小区
 **/
(function (vc) {
    var DEFAULT_PAGE = 1;
    var DEFAULT_ROWS = 10;
    vc.extends({
        data: {
            aStaffDetailHisFeeInfo: {
                feeDetails: [],
                staffId: '',
                state: ''
            }
        },
        _initMethod: function () {
            vc.getDict('return_pay_fee', "state", function (_data) {
                $that.aStaffDetailHisFeeInfo.returnPayFeeStates = _data;
            });
        },
        _initEvent: function () {
            vc.on('aStaffDetailHisFee', 'switch', function (_data) {
                $that.aStaffDetailHisFeeInfo.staffId = _data.staffId;
                $that._loadAStaffDetailHisFeeData(DEFAULT_PAGE, DEFAULT_ROWS)
            });
            vc.on('aStaffDetailHisFee', 'paginationPlus', 'page_event',
                function (_currentPage) {
                    $that._loadAStaffDetailHisFeeData(_currentPage, DEFAULT_ROWS);
                });
            vc.on('aStaffDetailHisFee', 'notify', function (_data) {
                $that._loadAStaffDetailHisFeeData(DEFAULT_PAGE, DEFAULT_ROWS);
            })
        },
        methods: {
            _loadAStaffDetailHisFeeData: function (_page, _row) {
                let param = {
                    params: {
                        cashierId: $that.aStaffDetailHisFeeInfo.staffId,
                        page: _page,
                        row: _row
                    }
                };
                //发送get请求
                vc.http.apiGet('/fee.queryAdminFeeDetail',
                    param,
                    function (json) {
                        let _json = JSON.parse(json);
                        $that.aStaffDetailHisFeeInfo.feeDetails = _json.feeDetails;
                        vc.emit('aStaffDetailHisFee', 'paginationPlus', 'init', {
                            total: _json.records,
                            dataCount: _json.total,
                            currentPage: _page
                        });
                    },
                    function () {
                        console.log('请求失败处理');
                    }
                );
            },
            //查询
            _qureyAStaffDetailHisFee: function () {
                $that._loadAStaffDetailHisFeeData(DEFAULT_PAGE, DEFAULT_ROWS);
            },
            _toRefundFee: function (_detail) {
                vc.jumpToPage('/#/pages/fee/adminFeeDetail?feeId=' + _detail.feeId);
            }
        }
    });
})(window.vc);